home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: undergrad.math.uwaterloo.ca!clgonsal
- From: clgonsal@undergrad.math.uwaterloo.ca (Carl Laurence Gonsalves)
- Subject: Re: Would/Won't you use a garbage collector?
- Sender: news@undergrad.math.uwaterloo.ca (news spool owner)
- Message-ID: <Dq0p81.F38@undergrad.math.uwaterloo.ca>
- Date: Wed, 17 Apr 1996 17:43:13 GMT
- References: <4kamie$e4d@dfw-ixnews3.ix.netcom.com> <4kjbeq$36u@preeda.internex.net.au> <4km6vv$hjt@dfw-ixnews4.ix.netcom.com>
- Nntp-Posting-Host: lhopital.uwaterloo.ca
- Organization: University of Waterloo
-
- In article <4km6vv$hjt@dfw-ixnews4.ix.netcom.com>,
- Giuliano Carlini <giuliano@ix.netcom.com> wrote:
- >In <4kjbeq$36u@preeda.internex.net.au> sultan@connexus.apana.org.au
- >(Jon Hornstein) writes:
- >
- >>Please mail to me where I can get GC packages. Thanks in advance!
- >>
- >A freeware library is available from parcftp.xerox.com/pub/gc.
- >A commercial library is available from geodesic systems:
- >www.geodesic.com
- >
- >DISCLOSURE: I'm associated with geodesic systems, and hope to profit
- >from licensing fees/royalties from them.
-
- Looking at Great Circle's technology overview (at www.geodesic.com) I see
- that there are two ways of using Great Circle.
-
- The "GCTransparent" way only requires that you link with a special library.
- It looks like Great Circle scans the stack, the registers, and the static
- data area looking for pointers to data on the heap. Of course, at run time
- there's no way to tell what's a pointer and what's not, so it just assumes
- that every word is a pointer. This is confirmed by the statement:
-
- "Since all data is examined, even difficult cases like unions and the
- storing of pointers in integers are automatically handled."
-
- This seems like a classic example of making a bug look like a feature. I
- may have code that hold a bunch of random integers. The chance that some of
- these random integers just happen to look like pointers to something on the
- heap is pretty high. This means Great Circle is going to "leak" any objects
- that seem to have pointers pointing at them. In fact, the bigger an object
- is, the greater the chance that it will be leaked, since Great Circle looks
- for pointers pointing anywhere within the object.
-
- The other way of using Great Circle ("GCPointers") uses some form of
- garbage collecting smart pointers. I have to wonder how well this works
- with other libraries though. I could imagine a template in a library
- creating "plain" pointers to an object the collector knows about. If the
- only pointers to a collectable object are "plain" pointers, then the
- collector won't know that the object is being pointed at, and it will
- delete it.
-
- Even so, the GCPointers idea seems less disagreeable than the leaky
- alternative. I'd really like to know how it could work with third-party
- libraries though. Would it be possible to use STL containers, for
- example, with GCPointers?
-
- --
- Carl Laurence Gonsalves - clgonsal@undergrad.math.uwaterloo.ca
- Computer Science, University of Waterloo
- http://www.undergrad.math.uwaterloo.ca/~clgonsal/
- http://www.csclub.uwaterloo.ca/~clgonsal/
-